import request from "@/utils/request";

type loginRes = {
    msg:string,
    code:string,
    token:string
}
/**
 * 获取验证码
 * @returns {Promise<AxiosResponse<any>>}
 */
export const getVerifyCode = () => request.get('/user/captcha')
/**
 * 登录
 * @param param
 * @returns {Promise<AxiosResponse<any>>}
 */
export const login = (param) => request({
    url: '/system/login',
    method: 'get',
    params: param
})
/**
 * 注册
 * @param param
 * @returns {Promise<AxiosResponse<any>>}
 */
export const register=(param)=>request.post('/user/add',param)
/**
 * 用户上传头像
 * @param param
 * @returns {Promise<AxiosResponse<any>>}
 */
export const uploaduserAvatar=(param)=>request.post('/file/userAvatar',param)

/**
 * 拿用户信息
 * @returns {Promise<AxiosResponse<any>>}
 */
export const getInfo= () => request({
    url: "/system/getInfo",
    method: 'get',
});



/**
 * 获取菜单和路由
 * @returns {AxiosPromise}
 */
export const generaMenu = ()=>request({url: "/menu/listUserMenus",method:'get'});

/**
 * 登出
 * @returns {AxiosPromise}
 */
export const logout= ()=>request({url:"/auth/logout",method:'get'});
